When the demand for gas increases, the pressure within the system drops, causing the diaphragm to move in a manner that opens the valve and allows more gas to flow. Conversely, if there is a decrease in demand, the diaphragm moves in the opposite direction, closing the valve to limit the flow. This automatic adjustment ensures that the gas pressure remains constant, providing a steady supply to consumers without risking over-pressurization.